<?php
// 获取商户类表

header("Content-type:text/html;charset=UTF-8");

session_start();
if (empty($_SESSION['id'])) {
    echo '{"code":"400","msg":"未登录"}';

    die();
}

$conn = mysqli_connect('127.0.0.1', 'root', 'root', 'lzp');
mysqli_query($conn, 'set names utf8');
$p=addslashes('p_tn18');
$sql = "select * from $p";
//执行 sql
$result = mysqli_query($conn, $sql);
// $info = mysqli_fetch_assoc($result);
// // var_dump($info);
// // while
// $data= json_encode($info);
// echo $data;
$arr = [];
while ($row = mysqli_fetch_assoc($result)) {
    $arr[] = $row;
}
echo json_encode($arr);